<?php

namespace App\Http\Requests\Config;

use Illuminate\Foundation\Http\FormRequest;

class UpdateConfig extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [

            'title' => 'required|unique:products,name,' . $this->route('product') . '|max:255',
            'keyword'=>'required',
            'description'=>'required',
            'thumb'=>'required',
            'icp'=>'required',
            'copyright'=>'required',
            'author'=>'required',
            'company'=>'required',
            'qq'=>'required|regex:/[1-9][0-9]{4,14}/',
            'email'=>'required|string|email|max:255|unique:users',
            'mobile'=>'required|regex:/^1[34578][0-9]{9}$/',
            'tel'=>'required|regex:/^0\d{2,3}-\d{7,8}(-\d{1,6})?$/',
            'fax'=>'required|regex:/^0\d{2,3}-\d{7,8}(-\d{1,6})?$/',

        ];
    }
}
